//
// Created by Administrator on 2023/12/23.
// 素数埃氏筛法
//


#include <cmath>
#include <iostream>

using namespace std;

int main()
{
    int n=100; // out: 25
    n = 1740948; // out: 130971
    n = 4974953; // out: 346862
//    n= 2115790; //out:156902
    bool arr[n+1]={0};
    for (int i = 2; i < n+1; ++i)
        arr[i]=1;
    for (int i = 2; i < n+1; ++i)
    {
        if(arr[i])
        {
            for (int j = i+i; j <= n; j+=i)
            {
                arr[j]=0;
            }
        }
    }
    int count = 0;
    for (int i = 2; i < n+1; ++i)
        if(arr[i])
            ++count;
    cout<<count;
    return 0;
}